<template>
  <div class="air">
    <div class="air_title">
      <i class="iconfont iconfeiji"></i>
      <span>国内机票</span>
    </div>
    <div class="air_form_wrap">
      <div class="air_form">
        <AirSearchForm />
      </div>
      <div class="air_form_banner">
        <img src="http://157.122.54.189:9093/images/pic_sale.jpeg">
      </div>
    </div>
    <!-- 出行保证 -->
    <div class="ensure">
      <div class="ensure_item">
        <i class="iconfont iconweibiaoti-_huabanfuben"></i>
        <span>航协认证</span>
      </div>
      <div class="ensure_item">
        <i class="iconfont iconbaozheng"></i>
        <span>航协认证</span>
      </div>
      <div class="ensure_item">
        <i class="iconfont icondianhua"></i>
        <span>航协认证</span>
      </div>
    </div>
    <!-- 特价机票 -->
    <div class="sales">
      <div class="sales_title">
        <i class="iconfont icontejiajipiao"></i>
        <span>特价机票</span>
      </div>
      <div class="sales_content">
        <div
          class="sales_img"
          v-for="(item,index) in  sales"
          :key="index"
          @click="goFlights(item)"
        >
          <img :src="$axios.defaults.baseURL+item.cover">
          <div class="sales_item_info">
            <span>{{item.departCity}}-{{item.destCity}}</span>
            <span>￥{{item.price}}</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      sales: [],
    };
  },
  async mounted() {
    const res = await this.$axios.get("/airs/sale");
    this.sales = res.data;
  },
  methods: {
    // 点击跳转到 机票列表页面
    goFlights({price,cover,...info}) {
      this.$router.push({ path: "/air/flights", query: info });
    },
  },
};
</script>

<style lang="less"  scoped  >
.air {
  width: 1000px;
  margin: 0 auto;
  .air_title {
    height: 55px;
    display: flex;
    align-items: center;
    color: orange;
    font-size: 20px;
    .iconfeiji {
      font-size: 20px;
      margin-right: 10px;
    }
  }
  .air_form_wrap {
    display: flex;
    justify-content: space-between;
    .air_form {
      width: 360px;
    }

    .air_form_banner {
      width: 620px;

      img {
        display: block;
      }
    }
  }
}

/* 出行保证 */
.ensure {
  background-color: #f5f5f5;
  border: 1px solid #ccc;
  height: 55px;
  display: flex;
  margin: 15px 0;
  .ensure_item {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 16px;
    border-right: 1px solid #ccc;
    &:last-child {
      border-right: none;
    }
    &:nth-child(2) {
      i {
        color: green;
      }
    }
    i {
      font-size: 25px;
      color: #409eff;
      margin-right: 3px;
    }
  }
}

/* 特价机票 */
.sales {
  .sales_title {
    height: 55px;
    display: flex;
    align-items: center;
    color: #409eff;
    font-size: 22px;
    .icontejiajipiao {
      margin-right: 10px;
      font-size: 22px;
    }

    span {
    }
  }

  .sales_content {
    display: flex;
    height: 180px;

    border: 1px solid #ccc;
    align-items: center;
    justify-content: space-evenly;
    margin-bottom: 50px;
    .sales_img {
      position: relative;
      cursor: pointer;

      img {
        width: 225px;
        height: 150px;
        display: block;
      }
      .sales_item_info {
        display: flex;
        justify-content: space-between;
        height: 30px;
        align-items: center;
        padding: 0 15px;
        color: #fff;
        background-color: rgba(0, 0, 0, 0.8);
        position: absolute;
        width: 100%;
        bottom: 0;
        left: 0;
      }
    }
  }
}
</style>